home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / SampleSMSAMServer / DebuggingGear.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  3.0 KB  |  114 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        DebuggingGear.h
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __DEBUGGINGGEAR__
  15. #define __DEBUGGINGGEAR__
  16.  
  17. #ifndef __DEBUGFLAGS__
  18. #include "DebugFlag.h"
  19. #endif
  20.  
  21. #ifndef __DEBUGSTREAM__
  22. #include "DebugStream.h"
  23. #endif
  24.  
  25. #ifndef __EVENTS__
  26. #include <Events.h>
  27. #endif
  28.  
  29. /***********************************|****************************************/
  30.  
  31. #if debug
  32.  
  33. //    These are the various streams to which output can be sent.
  34. extern debugstream keith, steve, kai, chris;
  35. extern TDebugFlag keithFlag, steveFlag, kaiFlag, chrisFlag, addressTypesFlag, debugFlag, miscFlag;
  36. extern Boolean gPausing, gReadyToQuit;
  37.  
  38. extern void FlushDebugBuffers ();
  39. extern Boolean    HandleDebuggingMenuEvent (EventRecord *event);
  40. extern void ShowErrorIf(Boolean showError, const char* text, OSErr err);
  41. extern void ShowOftenMemoryInfo();
  42. extern Boolean MemoryInfoChanged();
  43. extern Boolean StackSpaceIsLow();
  44. extern void CheckStackSpaceAndGiveWarningIfNecessary(const StringPtr where);
  45.  
  46. extern pascal void GetProcName(const void* pc, StringPtr procName);
  47. extern void StripArgumentsFromProcName(StringPtr procName);
  48.  
  49. extern void BreakStr (const Str255 breakString);
  50. extern void BreakStr (const char* breakString);
  51.  
  52. inline void DEBUGGER ( void ) 
  53.     if ( debugFlag.Flag ( 2 ) ) 
  54.         Debugger (); 
  55. };
  56.  
  57. inline void DEBUGSTR ( Str255& x )
  58. {
  59.     if ( debugFlag.Flag ( 2 ) )
  60.         DebugStr ( x );
  61. };
  62.  
  63. #define    keithDB(MESSAGE)        { keith << MESSAGE; keith << endl; }
  64. #define    steveDB(MESSAGE)        { steve << MESSAGE; steve << endl; }
  65. #define    chrisDB(MESSAGE)        { chris << MESSAGE; chris << endl; }
  66. #define    breakDB(MESSAGE)        { BreakStr(MESSAGE); }
  67.  
  68. #define    keithF(FLAG,MESSAGE)     { if (keithFlag.Flag(FLAG)) { keith << MESSAGE; keith << endl; }; };
  69. #define    steveF(FLAG,MESSAGE)    { if (steveFlag.Flag(FLAG)) { steve << MESSAGE; keith << endl; }; };
  70. #define    chrisF(FLAG,MESSAGE)     { if (chrisFlag.Flag(FLAG)) { chris << MESSAGE; keith << endl; }; };
  71. #define    debugF(FLAG,MESSAGE)     { if (debugFlag.Flag(FLAG)) { keith << MESSAGE; keith << endl; }; };
  72. #define    miscF(FLAG,MESSAGE)        { if ( miscFlag.Flag(FLAG)) { keith << MESSAGE; keith << endl; }; };
  73.  
  74. #else
  75.  
  76. inline void DebugDebugger ( void ) 
  77. };
  78.  
  79. inline void DebugDebugStr ( Str255& )
  80. {
  81. };
  82.  
  83. #define    keithDB(MESSAGE)        {  }
  84. #define    steveDB(MESSAGE)        {  }
  85. #define    chrisDB(MESSAGE)        {  }
  86.  
  87. #define    keithF(FLAG,MESSAGE)     {  }
  88. #define    steveF(FLAG,MESSAGE)    {  }
  89. #define    chrisF(FLAG,MESSAGE)     {  }
  90. #define    debugF(FLAG,MESSAGE)     {  }
  91. #define    miscF(FLAG,MESSAGE)        {  }
  92.  
  93. #endif
  94.  
  95. /***********************************|****************************************/
  96.  
  97. // If we're building a MPW test tool, define the streams so that they 
  98. // are the standard output stream cerr.
  99. #if BLJTestTool
  100.  
  101. #define    keith    cerr
  102. #define steve    cerr
  103. #define kai        cerr
  104. #define chris    cerr
  105.  
  106. #endif
  107.  
  108.  
  109. /***********************************|****************************************/
  110.  
  111. #endif    // __DEBUGGINGGEAR__
  112.